package lockTest;

/**
 * @author      : yang.xp
 * @date        : 2022/9/21 11:55
 * @description : java.lang.StackOverflowError
 * 栈深度:273558
 */
public class StackOOM {

    private int count = 0;

    public static void main(String[] args) {
        StackOOM stackOOM = new StackOOM();
        stackOOM.test();
    }

    // 0个参数20720
    // 1个参数a：20609
    // 2个参数a，b：19083
    public void testAdd() {
        count++;
        testAdd();
    }

    public void test() {
        try {
            testAdd();
        } catch (Throwable e) {
            System.out.println(e);
            System.out.println("栈深度:" + count);
        }
    }
}
